package srms.the512div2;

import java.util.Arrays;

/**
 * @author feuyeux@gmail.com 2011-7-16
 */
public class MarbleDecoration {

	public int maxLength(int r, int g, int b) {
		int a[] = { r, g, b };
		Arrays.sort(a);
		if (a[2] == a[1])
			return a[1] * 2;
		else
			return a[1] * 2 + 1;
	}

	private int getMiddle(int r, int g, int b) {
		int a[] = { r, g, b };
		Arrays.sort(a);
		return a[1];
	}

	public static void main(String[] args) {
		MarbleDecoration m = new MarbleDecoration();
		System.out.println(m.getMiddle(7, 6, 7) + "");
		System.out.println(m.getMiddle(6, 7, 5) + "");
		System.out.println(m.getMiddle(7, 5, 6) + "");

		System.out.println(m.maxLength(7, 6, 7) + "");
		System.out.println(m.maxLength(6, 7, 5) + "");
		System.out.println(m.maxLength(7, 5, 6) + "");
	}
}
